A simple trim function. This function replaces input values greater than or equal to the “b” parameter by the “a” parameter. Input values less than the “b” parameter are multiplied by a constant equal to the ratio between the “a” and “b” parameters. In the special case when “b” is zero, the function replaces all input values by the “a” parameter.
If the “a” and the “b” parameters both have the same sign (both positive or both negative), the “a” parameter is an upper bound on the output values. In such cases the ratio between “a” and “b” is positive, and the Trim1 function takes the following form:
Output = Min(Input (a/b), a)
On the other hand if the “a” and the “b” parameters have opposite signs, the “a” parameter is a lower bound on the output values. In such cases the ratio between “a” and “b” is negative, and the Trim1 function takes the following form:
Output = Max(Input (a/b), a)
In most cases you will probably use the Trim1 function with positive parameter values. In the special case when “a” and “ b” are equal, the Trim1 function takes the following simplified form:
Output = Min(Input, a)
Thus, in such cases the Trim1 function may be replaced by the Min function.